package qlc;
import chapter13.Circle;
import chapter13.Ellipse;
import chapter13.GeometricObject;
import chapter13.Rectangle;
public class BoundedTypeDemo {
    public static void main(String[] args) {
        Rectangle rectangle = new Rectangle(2, 2);
        Circle circle = new Circle(2);
        Ellipse ellipse=new Ellipse(2,2);

        System.out.println("Same area?" + equalArea(rectangle, circle));
        System.out.println("Same preimeter?"+ equalperimeter(rectangle,circle));
        System.out.println("Same Ellipse?" + equalArea(ellipse, circle));
        System.out.println("Same Ellipse?" + equalperimeter(ellipse, circle));
    }

    public static <E extends GeometricObject> boolean equalArea(
            E object1, E object2) {
        return object1.getArea() == object2.getArea();
    }

    public static <E extends GeometricObject> boolean equalperimeter(
            E object1, E object2) {
        return object1.getPerimeter() == object2.getPerimeter();
    }
}
